package com.example.aerospacemanagementsystem.controller.logistics;

import com.example.aerospacemanagementsystem.entity.basic.Job;
import com.example.aerospacemanagementsystem.entity.logistics.Item;
import com.example.aerospacemanagementsystem.service.basicService.JobService;
import com.example.aerospacemanagementsystem.service.logisticsService.impl.ItemService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 李铭
 */
@Api(tags = "物品发放记录")
@RestController
@CrossOrigin
@RequestMapping("/item")
public class ItemController {
    @Autowired
    private ItemService itemService;

    @PostMapping
    public int add(@RequestBody Item item){
        return itemService.add(item);
    }

    @DeleteMapping
    public int delete(Item item){
        return itemService.delete(item);
    }

    @PutMapping
    public int update(@RequestBody Item item){
        return itemService.update(item);
    }

    @GetMapping("/getAll")
    public List<Item> getAllCity(Item item) {
        List<Item> list = itemService.getAllItem(item);
        return list;
    }
}
